﻿@page "/globalexception"
@layout ComponentLayout
@inject IStringLocalizer<GlobalException> Localizer

<h3>@Localizer["Title"]</h3>

<p>@((MarkupString)Localizer["P1"].Value)</p>

<h4>@Localizer["H1"]</h4>

<p>@((MarkupString)Localizer["P2"].Value)</p>

<Pre>public void ConfigureServices(IServiceCollection services)
{
    services.AddLogging(builder => builder.AddConsole());
}</Pre>

<p>@((MarkupString)Localizer["P3"].Value)</p>

<Pre>&lt;BlazorLogger&gt;
    @@Body
&lt;/BlazorLogger&gt;</Pre>

<p>@((MarkupString)Localizer["P4"].Value)</p>

<Pre>[CascadingParameter]
[NotNull]
private IBlazorLogger? Logger { get; set; }

private void OnClick()
{
    try
    {
        var a = 0;
        var b = 1 / a;
    }
    catch(Exception ex)
    {
        Logger.Log(ex);
    }
}</Pre>

<p>@((MarkupString)Localizer["P5"].Value)</p>
<Pre>crit: BootstrapBlazor.Components.BlazorLogger[0]
      TimeStamp: 8/23/2021 12:20:46 PM
      MachineName: ECS-A399
      AppDomainName: BootstrapBlazor.Server
      OS: Microsoft Windows 10.0.17763
      OSArchitecture: X64
      ProcessArchitecture: X64
      Framework: .NET 5.0.9
      UserName: Argo
      EnvironmentName: Development
      IISRootPath: D:\Argo\src\BB\BootstrapBlazor\src\BootstrapBlazor.Server\
      VSIDE: Microsoft Visual Studio Enterprise 2019 16.0
      Exception:: Attempted to divide by zero.
      *********************************************
      System.DivideByZeroException: Attempted to divide by zero.
         at BootstrapBlazor.Shared.Pages.GlobalException.OnClick() in D:\Argo\src\BB\BootstrapBlazor\src\BootstrapBlazor.Shared\Pages\GlobalException.razor.cs:line 30</Pre>

<DemoBlock Title="@Localizer["Block1Title"]" Introduction="@Localizer["Block1Intro"]" Name="Normal">
    <p>@((MarkupString)Localizer["P6"].Value)</p>
    <Button Icon="fa fa-fa" Text="@Localizer["ButtonText"]" OnClick="OnClick" />
    <BlockLogger @ref="Trace" class="mt-3" />
</DemoBlock>
